package com.tuomaxu.demo.controller;

import com.tuomaxu.demo.service.TestService;
import com.tuomaxu.mvcframework.annotation.XYAutowired;
import com.tuomaxu.mvcframework.annotation.XYController;
import com.tuomaxu.mvcframework.annotation.XYRequestMapping;
import com.tuomaxu.mvcframework.annotation.XYSecurity;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@XYController
@XYSecurity({"tom1"})
@XYRequestMapping("/demo")
public class TestController {

    @XYAutowired("XYServiceImpl")
    private TestService service;

    @XYRequestMapping("/t1")
    public String t1(String username){
        return  service.query(username);
    }

    @XYRequestMapping("/t2")
    @XYSecurity({"tom2"})
    public String t2(HttpServletRequest req, HttpServletResponse resp, String username){
        return  service.query(username);
    }

    @XYRequestMapping("/t3")
    @XYSecurity({"tom3","tom4"})
    public String t3(String username,HttpServletRequest req){
        return  service.query(username);
    }


}
